/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function comprobarR(){
	var name = document.getElementById("name");
        var place = document.getElementById("place");
        var capacity = document.getElementById("capacity");
	var espacios = /^\s*$/;
	var campoNombre = /^Nombre$/;
        var noNumeros = /^\d/;
	var comentario = "";
	var error = false;
	var color;
	
	
	if(!(espacios.test(name.value))){
		color = document.getElementById("label_name");
		color.style.color = "black";
	}else{
		color = document.getElementById("label_name");
		color.style.color = "red";
	}
	if(espacios.test(name.value) || campoNombre.test(name.value)){
		comentario = comentario + "Debe rellenar el campo 'Nombre'.\n";
		color = document.getElementById("label_name");
		color.style.color = "red";
		error = true;
	}
        if(!(espacios.test(place.value))){
		color = document.getElementById("label_place");
		color.style.color = "black";
	}else{
		color = document.getElementById("label_place");
		color.style.color = "red";
	}
	if(espacios.test(place.value) || campoNombre.test(place.value)){
		comentario = comentario + "Debe rellenar el campo 'Place'.\n";
		color = document.getElementById("label_place");
		color.style.color = "red";
		error = true;
	}
         if(!(espacios.test(capacity.value))){
		color = document.getElementById("label_capacity");
		color.style.color = "black";
	}else{
		color = document.getElementById("label_capacity");
		color.style.color = "red";
	}
        if(noNumeros.test(capacity.value)){
		comentario = comentario + "Solo numeros\n";
		color = document.getElementById("label_dni");
		color.style.color = "red";
		error = true;
	}
	if(espacios.test(capacity.value) || campoNombre.test(capacity.value)){
		comentario = comentario + "Debe rellenar el campo 'Capacity'.\n";
		color = document.getElementById("label_capacity");
		color.style.color = "red";
		error = true;
	}
	if(error){
		alert(comentario);
	}
	return !error;
}
